/*
        Firesoft 
        
    Copyright (C) 2010, Arttu Viljakainen 
    Published under GNU General Public License V3 
    (see http://www.gnu.org/licenses/licenses.html)
    
    This file is part of Firesoft.

    Firesoft is free software: 
    you can redistribute it and/or modify it under the terms of the GNU General 
    Public License as published by the Free Software Foundation, 
    either version 3 of the License, or (at your option) any later version.

    Firesoft is distributed in the hope that it will be useful, 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 
    Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Tool for Path Finding Algorithm Testing. If not, see         
    <http://www.gnu.org/licenses/>.
 */
package softstarter.gui.subareas.settings;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JRadioButton;


public class SettingsViewListener implements ActionListener {

	private SettingsViewController controller;

	public SettingsViewListener(SettingsViewController controller, SettingsView view) {
        this.controller = controller;
    }
    
    @Override
    public void actionPerformed(ActionEvent event) {
        if(event.getActionCommand().equals("Save")) {
            controller.saveChangesToFiles();
        } else if(event.getActionCommand().equals("Remove old files")) {
        	controller.removeOldFiles();
        } else if(event.getActionCommand().equals("Remove all files")) {
        	controller.removeAllFiles();
        } else if(event.getActionCommand().equals("Index a folder")) {
        	controller.indexAFolder();
        } else if(event.getActionCommand().equals("Reject")) {
        	controller.rejectChangesToFiles();
        } else if(event.getActionCommand().equals("Show decorations")) {
        	boolean decorated = ((JRadioButton)event.getSource()).isSelected();
        	controller.setDecoration(decorated);
        } else if(event.getActionCommand().equals("Always on top")) {
        	boolean alwaysOnTOp = ((JRadioButton)event.getSource()).isSelected();
        	controller.setAlwaysOnTOp(alwaysOnTOp);
        }
    }    

}
